package nine.test_9_6;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.concurrent.BlockingDeque;

public class TestMain1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Long m = scanner.nextLong();
        int[] as = new int[n];
        int[] bs = new int[n];
        int[] maxa = new int[n];
        int[] maxb = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = scanner.nextInt();
        }
        for (int i = 0; i < n; i++) {
            bs[i] = scanner.nextInt();
        }
        for (int i = 0; i < n; i++) {
            maxa[n - i - 1] = as[i];
            maxb[n - i - 1] = bs[i];

            Long count = 0L;
            for (int j = n - 1; j >= n - i - 1; j--) {
                count += (maxb[j] * maxa[j]);
                if(count >= m) {
                    System.out.println(i);
                    return;
                }
            }
        }
        System.out.println(-1);
    }

}
